from loguru import logger
from tabulate import tabulate
from rich.progress import track
from tqdm import tqdm
class base(object):
    def __init__(self, cfg) -> None:
        self.base_cfg = cfg.get("Base")
        self.train_cfg = cfg.get("Train")
        logger.add("./log/mht_{time}.log")
        self.track = track
        self.tqdm = tqdm
    def info(self, content):
        logger.info(content)

    def debug(self, content):
        logger.debug(content)

    def error(self, content):
        logger.error(content)

    def log_args(self, cfg, title):
        """
        Input:
            - args cfg 字典
            - args title 标题
        """
        tabel_data = []
        tabel_header = ['key', 'value']
        print("=============={}================".format(title))
        for key, value in cfg.items():
            tabel_data.append((key, value))
        tabel = tabulate(tabel_data, headers=tabel_header, tablefmt='fancy_grid')
        self.info(tabel)


    
